how to react on a html button click in php

92

<script>
function test(){
    $.ajax({url:"echo.php", success:function(result){
    $("div").text(result);}
})
} 
</script>
#php 7.x
<?php
function php_func(){
    echo " Have a great day";
}
php_func();
?>
<button onclick="test()"> Click </button>
<div> </div>

Comments

Submit
0 Comments